package vcsn.utils;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import vcsn.Config;

public class Util {
	public static File createTempFile(){
		try {
			return File.createTempFile(String.format(Config.tempFilePrefix, new SimpleDateFormat(Config.FormattedDateTimeFileName).format(new Date())), "");
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}		
	}
	
	public static File createTempCommitPatchFile(){
		try {
			return File.createTempFile(String.format(Config.tempPatchFilePrefix, new SimpleDateFormat(Config.FormattedDateTimeFileName).format(new Date())), "");
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}		
	}
	
	public static File createTempRelationMapDiffPatchFile(){
		try {
			return File.createTempFile(String.format(Config.tempRelationMapDiffPatchFilePrefix, new SimpleDateFormat(Config.FormattedDateTimeFileName).format(new Date())), "");
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
		
	}
}
